package edu.cuit.avatar.p1;

import edu.cuit.avatar.Circle;
import edu.cuit.avatar.CircleTest;

/**
 * @author <a href="mailto:1020zhaodan@163.com">Adan</a>
 * @version 1.0
 * @date 2025/7/4 10:37
 */
public class StudentTest {
    public static void main(String[] args) {
//        Student peppa = new Student();
//        System.out.println(peppa); //toString()
//        System.out.println(peppa.toString()); //toString() ==> 对象类型@hash地址
//
//        System.out.println(peppa.name);
//        System.out.println(peppa.age);
//        System.out.println(peppa.isScienceMajor);
//        System.out.println(peppa.gender);

//        peppa = null;
//
//        int x = 10; //局部变量必须初始化后才能使用
//        System.out.println(x);
//
//        System.out.println(peppa.name); //NullPointerException


        var peppa = new Student("Peppa", 5, true, 'F');
        peppa.setName("小猪Peppa");
        peppa.show();

        var emily = new Student("Emily", 6, false, 'F');
        peppa.show();


        System.out.println(Student.getNextId());

        //对象数组
        var students = new Student[]{peppa, emily,
                new Student("Pedro", 5,true,'M')};

        var pedro = students[2];
        pedro.show();

        for(var s : students)
            s.show();

        //1. 匿名对象(调用一次实例方法)
        //System.out.println(new Circle(5).getArea());
        //2.作为方法的参数进行传递
        CircleTest.printCircle(5, new Circle(10));
    }
}
